package com.nextive.tweetfinder.controller;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;

import com.nextive.tweetfinder.R;

/**
 * Lets the user input a search query and submit it.
 * 
 * @author federicobaseggio
 */
public class TweetFinderActivity extends Activity {
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        
        Button findButton = (Button) findViewById(R.id.findButton);
        final EditText searchEditText = (EditText) findViewById(R.id.searchEditText);
        findButton.setOnClickListener(new OnClickListener() {
			public void onClick(View v) {
				String searchTerms = searchEditText.getText().toString();
				Intent intent = new Intent(TweetFinderActivity.this, ResultsActivity.class);
				intent.putExtra("search", searchTerms);
				startActivity(intent);
			}
		});
    }
}